package com.androidmvc.base.core;


import com.androidmvc.base.utils.L;

/**
 * 这个类，用于处理本地耗时操作，如查询数据库
 *
 * @author jmh
 */
public class DataCore extends CoreEventHandler {
    private static final String LOG_TAG = "DataCore";
    private volatile static DataCore instance;

    public static DataCore getInstance(UCore core) {
        if (instance == null) {
            synchronized (DataCore.class) {
                if (instance == null) {
                    instance = new DataCore(core);
                }
            }
        }
        return instance;
    }

    private DataCore(UCore core) {
        this.uCore = core;
    }

    @Override
    public void handleCoreEvent(int event, Object data) {
        L.i(LOG_TAG, "datacore current thread name:" + Thread.currentThread().getId());
        switch (event) {
            case UCore.U_EXIT:
                onExit();
                break;
            default:
                break;
        }
    }

    @Override
    public void onExit() {
        super.onExit();
    }

}
